package com.gitee.l0km.casban;

import com.google.common.base.Supplier;
import com.google.common.collect.Range;

/**
 * 数量限制策略
 * @author guyadong
 *
 */
public enum CountLimitStrategy  implements Supplier<RangeFilter> {
	/** 要求大于等于0 */ANY(Range.<Integer>atLeast(0)),
	/** 要求大于0 */NOT_EMPTY(Range.atLeast(1)),
	/** 要求大于0,小于等于1 */MOST_ONE(Range.closed(0,1)),
	/** 要求为1 */ONLY_ONE(Range.singleton(1));
	public final RangeFilter sizeFilter ;

	private CountLimitStrategy(Range<Integer> filter) {
		this.sizeFilter = new RangeFilter(filter);
	}

	@Override
	public RangeFilter get() {
		return sizeFilter;
	}
}
